1. Technology Field
The present invention generally relates to a data storage method and a data storage system, and more particularly, to a data storage method for writing data into a flash memory and a data storage system using the same.
2. Description of Related Art
Along with the widespread of digital cameras, cell phones, and MP3 in recently years, the consumers' demand to storage media has increased drastically. Flash memory is one of the most adaptable memories for such battery-powered portable products due to its characteristics such as data non-volatility, low power consumption, small volume, and non-mechanical structure. A solid state drive (SSD) is a storage device which uses a NAND flash memory as its storage medium.
Generally speaking, a flash memory module in a flash memory storage device has a plurality of physical blocks, and a flash memory controller of the flash memory storage device logically groups these physical blocks into a system area, a data area, a spare area, and a replacement area. The physical blocks in the system area are used for storing information related to the flash memory storage device, and the physical blocks in the replacement area are used for replacing damaged physical blocks in the data area and the spare area. In a general access state, a host system (e.g. a computer) cannot access the physical blocks in the system area and the replacement area. The physical blocks in the data area are used for storing valid data written by write commands, and the physical blocks in the spare area are used for substituting the physical blocks in the data area when the write commands are executed. To be specific, when a flash memory storage device receives a write command from a host system for writing new data to update old data stored in a physical block to be updated in the data area, the control circuit of the flash memory storage device selects a physical block form the spare area, and writes the valid old data originally stored in the physical block to be updated in the data area and the new data into the physical block selected from the spare area. Then the flash memory storage device logically links the physical block containing the new data to the data area and erases the physical block to be updated in the data area and links it to the spare area. In order to allow the host system to successfully access the physical blocks which are alternatively used for storing data, the flash memory storage device provides logical blocks to the host system. Namely, the flash memory storage device reflects the alternation of the physical blocks by recording and updating the mapping relationship between the logical blocks and the physical blocks belonging to the data area in a logical address-physical address mapping table. Thus, the host system simply writes data into the provided logical block while the control circuit of the flash memory storage device accesses the corresponding physical block according to the logical address-physical address mapping table.
Based on the operation mechanism of flash memory storage device described above, if a computer system frequently writes and updates data in small quantities at a specific flash memory storage address, the flash memory storage device needs to execute foregoing data moving and erasing operations repeatedly. In particular, when a data of large quantity is to be moved, the access speed of the flash memory storage device will be greatly reduced. Besides, a physical block can only be erased for a limited number of times (for example, a physical block will be damaged after it is erased for 10,000 times). Accordingly, the lifespan of a flash memory storage device will be greatly shortened if the physical blocks therein are frequently erased.
However, a conventional flash memory storage device cannot identify the pattern that a computer system uses each flash memory storage address (for example, whether data in small quantities is repeatedly updated in a flash memory storage address). Thus, the conventional flash memory storage device cannot store data into a flash memory storage address according to different usage pattern thereof. As a result, the access speed of the flash memory storage device may be greatly reduced and the lifespan thereof may be shortened. Nothing, however, herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.